@ibiz-template-plugin/ai-chat 0.0.70 → 0.0.71
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.es.js
CHANGED
|
@@ -581,17 +581,17 @@ function ka(n) {
|
|
|
581
581
|
};
|
|
582
582
|
}
|
|
583
583
|
function so(n, e, t, i, r, s, o, a, l, c) {
|
|
584
|
-
var d, u, h, p, m, y, g, v, b, C, w, k, T, S, E, M, B,
|
|
584
|
+
var d, u, h, p, m, y, g, v, b, C, w, k, T, S, E, M, B, H = e.type;
|
|
585
585
|
if (e.constructor != null)
|
|
586
586
|
return null;
|
|
587
587
|
128 & t.__u && (l = !!(32 & t.__u), s = [a = e.__e = t.__e]), (d = $.__b) && d(e);
|
|
588
588
|
e:
|
|
589
|
-
if (typeof
|
|
589
|
+
if (typeof H == "function")
|
|
590
590
|
try {
|
|
591
|
-
if (v = e.props, b = "prototype" in
|
|
592
|
-
b &&
|
|
591
|
+
if (v = e.props, b = "prototype" in H && H.prototype.render, C = (d = H.contextType) && i[d.__c], w = d ? C ? C.props.value : d.__ : i, t.__c ? g = (u = e.__c = t.__c).__ = u.__E : (b ? e.__c = u = new H(v, w) : (e.__c = u = new je(v, w), u.constructor = H, u.render = x0), C && C.sub(u), u.props = v, u.state || (u.state = {}), u.context = w, u.__n = i, h = u.__d = !0, u.__h = [], u._sb = []), b && u.__s == null && (u.__s = u.state), b && H.getDerivedStateFromProps != null && (u.__s == u.state && (u.__s = nt({}, u.__s)), nt(u.__s, H.getDerivedStateFromProps(v, u.__s))), p = u.props, m = u.state, u.__v = e, h)
|
|
592
|
+
b && H.getDerivedStateFromProps == null && u.componentWillMount != null && u.componentWillMount(), b && u.componentDidMount != null && u.__h.push(u.componentDidMount);
|
|
593
593
|
else {
|
|
594
|
-
if (b &&
|
|
594
|
+
if (b && H.getDerivedStateFromProps == null && v !== p && u.componentWillReceiveProps != null && u.componentWillReceiveProps(v, w), !u.__e && u.shouldComponentUpdate != null && u.shouldComponentUpdate(v, u.__s, w) === !1 || e.__v == t.__v) {
|
|
595
595
|
for (e.__v != t.__v && (u.props = v, u.state = u.__s, u.__d = !1), e.__e = t.__e, e.__k = t.__k, e.__k.some(function(J) {
|
|
596
596
|
J && (J.__ = e);
|
|
597
597
|
}), k = 0; k < u._sb.length; k++)
|
|
@@ -1970,7 +1970,7 @@ function F0(n, e) {
|
|
|
1970
1970
|
var t = Jn(Lt++, 4);
|
|
1971
1971
|
!Z.__s && lo(t.__H, e) && (t.__ = n, t.u = e, K.__h.push(t));
|
|
1972
1972
|
}
|
|
1973
|
-
function
|
|
1973
|
+
function V(n) {
|
|
1974
1974
|
return dn = 5, Re(function() {
|
|
1975
1975
|
return { current: n };
|
|
1976
1976
|
}, []);
|
|
@@ -2465,7 +2465,7 @@ function D(n) {
|
|
|
2465
2465
|
}, []);
|
|
2466
2466
|
}
|
|
2467
2467
|
function ne(n) {
|
|
2468
|
-
var e =
|
|
2468
|
+
var e = V(n);
|
|
2469
2469
|
return e.current = n, er.__$f |= 4, Re(function() {
|
|
2470
2470
|
return Id(function() {
|
|
2471
2471
|
return e.current();
|
|
@@ -3405,7 +3405,7 @@ const K0 = () => /* @__PURE__ */ f("svg", { viewBox: "0 0 1024 1024", version: "
|
|
|
3405
3405
|
}
|
|
3406
3406
|
);
|
|
3407
3407
|
const Hd = (n) => {
|
|
3408
|
-
const { item: e } = n, t = D(!0), i = new z("chat-think"), r =
|
|
3408
|
+
const { item: e } = n, t = D(!0), i = new z("chat-think"), r = V(null), s = D(""), o = D(!1);
|
|
3409
3409
|
let a;
|
|
3410
3410
|
const l = (u) => {
|
|
3411
3411
|
u.stopPropagation(), !o.value && (a && clearTimeout(a), o.value = !0, navigator.clipboard.writeText(
|
|
@@ -3922,29 +3922,42 @@ const jd = (n) => {
|
|
|
3922
3922
|
] });
|
|
3923
3923
|
};
|
|
3924
3924
|
const ai = new z("chat-search"), po = (n) => {
|
|
3925
|
-
const {
|
|
3926
|
-
|
|
3927
|
-
|
|
3928
|
-
|
|
3929
|
-
|
|
3930
|
-
|
|
3925
|
+
const {
|
|
3926
|
+
value: e,
|
|
3927
|
+
className: t,
|
|
3928
|
+
placeholder: i,
|
|
3929
|
+
autoFocus: r = !1,
|
|
3930
|
+
onChange: s,
|
|
3931
|
+
onEnter: o
|
|
3932
|
+
} = n, [a, l] = q(!1), c = V(null);
|
|
3933
|
+
L(() => {
|
|
3934
|
+
var h;
|
|
3935
|
+
r && ((h = c.current) == null || h.focus());
|
|
3936
|
+
}, []);
|
|
3937
|
+
const d = (h) => {
|
|
3938
|
+
var p;
|
|
3939
|
+
h.stopPropagation(), s == null || s((p = h.target) == null ? void 0 : p.value);
|
|
3940
|
+
}, u = (h) => {
|
|
3941
|
+
var p;
|
|
3942
|
+
h.code === "Enter" && (o == null || o((p = h.target) == null ? void 0 : p.value));
|
|
3931
3943
|
};
|
|
3932
3944
|
return /* @__PURE__ */ f(
|
|
3933
3945
|
"div",
|
|
3934
3946
|
{
|
|
3935
|
-
className: "".concat(ai.b(), " ").concat(ai.is("focus",
|
|
3947
|
+
className: "".concat(ai.b(), " ").concat(ai.is("focus", a), " ").concat(t || ""),
|
|
3936
3948
|
children: [
|
|
3937
3949
|
/* @__PURE__ */ f("div", { className: ai.e("prefix"), children: /* @__PURE__ */ f(gg, {}) }),
|
|
3938
3950
|
/* @__PURE__ */ f(
|
|
3939
3951
|
"input",
|
|
3940
3952
|
{
|
|
3941
|
-
value:
|
|
3953
|
+
value: e,
|
|
3954
|
+
ref: c,
|
|
3942
3955
|
className: ai.e("inner"),
|
|
3943
3956
|
placeholder: i,
|
|
3944
|
-
onFocus: () =>
|
|
3945
|
-
onBlur: () =>
|
|
3946
|
-
onChange: (
|
|
3947
|
-
onKeyDown:
|
|
3957
|
+
onFocus: () => l(!0),
|
|
3958
|
+
onBlur: () => l(!1),
|
|
3959
|
+
onChange: (h) => d(h),
|
|
3960
|
+
onKeyDown: u
|
|
3948
3961
|
}
|
|
3949
3962
|
)
|
|
3950
3963
|
]
|
|
@@ -3976,7 +3989,7 @@ const ge = new z("chat-single-select"), Ud = (n) => {
|
|
|
3976
3989
|
icon: c,
|
|
3977
3990
|
onChange: d,
|
|
3978
3991
|
onSearch: u
|
|
3979
|
-
} = n, h = !!t.length, p =
|
|
3992
|
+
} = n, h = !!t.length, p = V(null), m = V(null), y = D(""), [g, v] = q(e), [b, C] = q(t), [w, k] = q(!1), [T, S] = q(!1), E = ((qe = t.find((j) => j.value === g)) == null ? void 0 : qe.label) || l;
|
|
3980
3993
|
L(() => {
|
|
3981
3994
|
w === !1 && (y.value = "", C(t));
|
|
3982
3995
|
}, [w]), L(() => {
|
|
@@ -3996,7 +4009,7 @@ const ge = new z("chat-single-select"), Ud = (n) => {
|
|
|
3996
4009
|
v(j.value), d == null || d(j.value), k(!1);
|
|
3997
4010
|
}, B = (j) => {
|
|
3998
4011
|
y.value = j;
|
|
3999
|
-
},
|
|
4012
|
+
}, H = async (j) => {
|
|
4000
4013
|
try {
|
|
4001
4014
|
S(!0);
|
|
4002
4015
|
let re = [];
|
|
@@ -4051,8 +4064,9 @@ const ge = new z("chat-single-select"), Ud = (n) => {
|
|
|
4051
4064
|
po,
|
|
4052
4065
|
{
|
|
4053
4066
|
placeholder: "搜索",
|
|
4067
|
+
autoFocus: !0,
|
|
4054
4068
|
value: y.value,
|
|
4055
|
-
onEnter:
|
|
4069
|
+
onEnter: H,
|
|
4056
4070
|
onChange: B
|
|
4057
4071
|
}
|
|
4058
4072
|
) }) : null,
|
|
@@ -4070,7 +4084,7 @@ const we = new z("chat-multiple-select"), Ig = (n) => {
|
|
|
4070
4084
|
icon: o,
|
|
4071
4085
|
onChange: a,
|
|
4072
4086
|
onSearch: l
|
|
4073
|
-
} = n, c =
|
|
4087
|
+
} = n, c = V(null), d = V(null), u = D(""), [h, p] = q(!1), [m, y] = q(!1), [g, v] = q(e || []), [b, C] = q(t);
|
|
4074
4088
|
L(() => {
|
|
4075
4089
|
h === !1 && (u.value = "", C(t));
|
|
4076
4090
|
}, [h]), L(() => {
|
|
@@ -4079,16 +4093,16 @@ const we = new z("chat-multiple-select"), Ig = (n) => {
|
|
|
4079
4093
|
C(t);
|
|
4080
4094
|
}, [t]), L(() => {
|
|
4081
4095
|
const M = (B) => {
|
|
4082
|
-
var
|
|
4083
|
-
B.stopPropagation(), !(B.target && ((
|
|
4096
|
+
var H, J;
|
|
4097
|
+
B.stopPropagation(), !(B.target && ((H = d.current) != null && H.contains(B.target))) && ((J = c.current) != null && J.contains(B.target) ? p((qe) => !qe) : p(!1));
|
|
4084
4098
|
};
|
|
4085
4099
|
return document.addEventListener("mousedown", M), () => {
|
|
4086
4100
|
document.removeEventListener("mousedown", M);
|
|
4087
4101
|
};
|
|
4088
4102
|
}, []);
|
|
4089
4103
|
const w = (M) => {
|
|
4090
|
-
const
|
|
4091
|
-
v(
|
|
4104
|
+
const H = g.includes(M.value) ? g.filter((J) => J !== M.value) : [...g, M.value];
|
|
4105
|
+
v(H), a == null || a(H);
|
|
4092
4106
|
}, k = (M) => {
|
|
4093
4107
|
u.value = M;
|
|
4094
4108
|
}, T = async (M) => {
|
|
@@ -4096,7 +4110,7 @@ const we = new z("chat-multiple-select"), Ig = (n) => {
|
|
|
4096
4110
|
y(!0);
|
|
4097
4111
|
let B = [];
|
|
4098
4112
|
l ? B = await l(M) : B = t.filter(
|
|
4099
|
-
(
|
|
4113
|
+
(H) => H.label.toLowerCase().includes(M.toLowerCase())
|
|
4100
4114
|
), C(B);
|
|
4101
4115
|
} catch (B) {
|
|
4102
4116
|
C([]), console.error("搜索失败:", B);
|
|
@@ -4104,8 +4118,8 @@ const we = new z("chat-multiple-select"), Ig = (n) => {
|
|
|
4104
4118
|
y(!1);
|
|
4105
4119
|
}
|
|
4106
4120
|
}, S = (M) => {
|
|
4107
|
-
var B,
|
|
4108
|
-
M.target && ((B = d.current) != null && B.contains(M.target) || (
|
|
4121
|
+
var B, H;
|
|
4122
|
+
M.target && ((B = d.current) != null && B.contains(M.target) || (H = c.current) != null && H.contains(M.target)) || n.onEnableChange && n.onEnableChange();
|
|
4109
4123
|
}, E = () => m ? /* @__PURE__ */ f(Wd, {}) : b.length ? b.map((M) => /* @__PURE__ */ f(
|
|
4110
4124
|
"li",
|
|
4111
4125
|
{
|
|
@@ -4162,6 +4176,7 @@ const we = new z("chat-multiple-select"), Ig = (n) => {
|
|
|
4162
4176
|
po,
|
|
4163
4177
|
{
|
|
4164
4178
|
placeholder: "搜索",
|
|
4179
|
+
autoFocus: !0,
|
|
4165
4180
|
value: u.value,
|
|
4166
4181
|
onEnter: T,
|
|
4167
4182
|
onChange: k
|
|
@@ -4436,13 +4451,13 @@ $.diffed = function(n) {
|
|
|
4436
4451
|
};
|
|
4437
4452
|
const Ga = new z("chat-slider"), Xg = Pg(
|
|
4438
4453
|
(n, e) => {
|
|
4439
|
-
const { min: t, max: i, step: r, onChange: s } = n, o =
|
|
4454
|
+
const { min: t, max: i, step: r, onChange: s } = n, o = V(null), a = D(n.value), l = Math.max.apply(
|
|
4440
4455
|
null,
|
|
4441
4456
|
[t, i, r].map((v) => {
|
|
4442
4457
|
const b = "".concat(v).split(".")[1];
|
|
4443
4458
|
return b ? b.length : 0;
|
|
4444
4459
|
})
|
|
4445
|
-
), c =
|
|
4460
|
+
), c = V({
|
|
4446
4461
|
dragging: !1,
|
|
4447
4462
|
startX: 0,
|
|
4448
4463
|
newPosition: 0,
|
|
@@ -4508,7 +4523,7 @@ const ci = new z("chat-slider"), Xa = (n) => {
|
|
|
4508
4523
|
showText: s = !1,
|
|
4509
4524
|
className: o = "",
|
|
4510
4525
|
onChange: a
|
|
4511
|
-
} = n, l =
|
|
4526
|
+
} = n, l = V(null), c = V(null), d = D(r), u = ne(() => ({
|
|
4512
4527
|
width: "".concat(100 * (d.value - t) / (i - t), "%"),
|
|
4513
4528
|
left: "0%"
|
|
4514
4529
|
}));
|
|
@@ -4582,7 +4597,7 @@ const Le = new z("chat-step-item"), Zg = (n) => {
|
|
|
4582
4597
|
title: "思考完成",
|
|
4583
4598
|
description: "",
|
|
4584
4599
|
done: !0
|
|
4585
|
-
}), p =
|
|
4600
|
+
}), p = V(null), m = V(null), y = () => {
|
|
4586
4601
|
e.title ? i(e.title) : d.value && (d.value.length > 20 && i("".concat(d.value.substring(0, 19), "...")), i(d.value.substring(0, 19)));
|
|
4587
4602
|
}, g = () => {
|
|
4588
4603
|
if (m.current) {
|
|
@@ -4998,7 +5013,7 @@ const St = new z("markdown-message"), n2 = (n) => {
|
|
|
4998
5013
|
] });
|
|
4999
5014
|
};
|
|
5000
5015
|
const Oe = new z("user-message-question"), i2 = (n) => {
|
|
5001
|
-
const e = Xe(), t = D(null), i = D(135), r = D(!0), s = D(!1), o =
|
|
5016
|
+
const e = Xe(), t = D(null), i = D(135), r = D(!0), s = D(!1), o = V(null), a = ne(() => n.message.content), l = ne(() => Mn.parseMixedContent(a.value));
|
|
5002
5017
|
L(() => {
|
|
5003
5018
|
t.value = new Cc({
|
|
5004
5019
|
id: e,
|
|
@@ -5393,7 +5408,7 @@ const Te = new z("chat-toolbar-item"), l2 = (n) => {
|
|
|
5393
5408
|
disabled: r = !1,
|
|
5394
5409
|
buttonType: s = "default",
|
|
5395
5410
|
onClick: o
|
|
5396
|
-
} = n, [a, l] = q(!1), c =
|
|
5411
|
+
} = n, [a, l] = q(!1), c = V(null), d = (b) => typeof b.hidden == "function" ? b.hidden(t) : b.hidden === !0;
|
|
5397
5412
|
if (d(e))
|
|
5398
5413
|
return /* @__PURE__ */ f(We, {});
|
|
5399
5414
|
const u = (b) => r ? !0 : typeof b.disabled == "function" ? b.disabled(t) : b.disabled === !0, h = (b) => {
|
|
@@ -5622,7 +5637,7 @@ const u2 = (n) => {
|
|
|
5622
5637
|
);
|
|
5623
5638
|
};
|
|
5624
5639
|
const el = new z("chat-messages"), tl = (n) => {
|
|
5625
|
-
const e =
|
|
5640
|
+
const e = V(null), t = 5, [i, r] = q(t), [s, o] = q(!1), [a, l] = q(!0), c = V(!1), d = n.controller.messages, u = Re(() => {
|
|
5626
5641
|
const g = Math.max(0, d.value.length - i);
|
|
5627
5642
|
return d.value.slice(g);
|
|
5628
5643
|
}, [d.value, i]), h = Re(() => i < d.value.length, [d.value, i]), p = () => {
|
|
@@ -7942,7 +7957,7 @@ const Yd = ({
|
|
|
7942
7957
|
onAction: a
|
|
7943
7958
|
// 接收行为事件回调
|
|
7944
7959
|
}) => {
|
|
7945
|
-
const l = new z("pop"), c = ao(gr), [d, u] = q(s || !1), h =
|
|
7960
|
+
const l = new z("pop"), c = ao(gr), [d, u] = q(s || !1), h = V(null), p = V(null), m = V(null);
|
|
7946
7961
|
L(() => {
|
|
7947
7962
|
s !== void 0 && u(s);
|
|
7948
7963
|
}, [s]), L(() => (p.current || (p.current = document.createElement("div"), p.current.className = l.b("content-container"), document.body.appendChild(p.current)), () => {
|
|
@@ -19175,9 +19190,9 @@ function g8(n) {
|
|
|
19175
19190
|
m8(S, s.find, o).forEach((M) => {
|
|
19176
19191
|
if (M.index === void 0)
|
|
19177
19192
|
return;
|
|
19178
|
-
const B = k + M.index + 1,
|
|
19193
|
+
const B = k + M.index + 1, H = B + M[0].length, J = {
|
|
19179
19194
|
from: t.tr.mapping.map(B),
|
|
19180
|
-
to: t.tr.mapping.map(
|
|
19195
|
+
to: t.tr.mapping.map(H)
|
|
19181
19196
|
}, qe = s.handler({
|
|
19182
19197
|
state: t,
|
|
19183
19198
|
range: J,
|
|
@@ -20784,9 +20799,9 @@ function E8(n) {
|
|
|
20784
20799
|
const M = S.exec(E);
|
|
20785
20800
|
if (M === null)
|
|
20786
20801
|
break;
|
|
20787
|
-
const B = M.index,
|
|
20802
|
+
const B = M.index, H = M[1];
|
|
20788
20803
|
if (!((m = M[2]) != null && m.endsWith(":::"))) {
|
|
20789
|
-
if (
|
|
20804
|
+
if (H)
|
|
20790
20805
|
w += 1;
|
|
20791
20806
|
else if (w -= 1, w === 0) {
|
|
20792
20807
|
const J = E.slice(0, B);
|
|
@@ -22124,7 +22139,7 @@ const pc = new z("chat-editor"), fy = ({
|
|
|
22124
22139
|
onChange: r,
|
|
22125
22140
|
onKeyDown: s
|
|
22126
22141
|
}) => {
|
|
22127
|
-
const o =
|
|
22142
|
+
const o = V(null), a = V(null);
|
|
22128
22143
|
return L(() => {
|
|
22129
22144
|
if (!a.current)
|
|
22130
22145
|
return;
|
|
@@ -22256,7 +22271,7 @@ const _e = new z("chat-agent-setting"), py = [
|
|
|
22256
22271
|
chunkpageindex: u.chunkpageindex !== void 0
|
|
22257
22272
|
};
|
|
22258
22273
|
}, [e.activeAIAgentID]);
|
|
22259
|
-
const i =
|
|
22274
|
+
const i = V(null), r = V(null), [s, o] = q(!1);
|
|
22260
22275
|
L(() => {
|
|
22261
22276
|
const u = (h) => {
|
|
22262
22277
|
var p, m;
|
|
@@ -22356,7 +22371,7 @@ const G = new z("chat-input"), mc = window.SpeechRecognition || window.webkitSpe
|
|
|
22356
22371
|
var C;
|
|
22357
22372
|
const [e, t] = q(!1);
|
|
22358
22373
|
ao(gr);
|
|
22359
|
-
const i = n.controller.input, r = D(!1), s =
|
|
22374
|
+
const i = n.controller.input, r = D(!1), s = V(), o = V(null);
|
|
22360
22375
|
mc && !s.current && (s.current = new mc(), s.current.onstart = () => {
|
|
22361
22376
|
r.value = !0;
|
|
22362
22377
|
}, s.current.onend = () => {
|
|
@@ -22375,10 +22390,10 @@ const G = new z("chat-input"), mc = window.SpeechRecognition || window.webkitSpe
|
|
|
22375
22390
|
return E.textContent || "";
|
|
22376
22391
|
if (E.nodeType !== Node.ELEMENT_NODE)
|
|
22377
22392
|
return "";
|
|
22378
|
-
const M = E, B = M.tagName.toLowerCase(),
|
|
22393
|
+
const M = E, B = M.tagName.toLowerCase(), H = Array.from(M.childNodes).map((J) => T(J)).join("");
|
|
22379
22394
|
switch (B) {
|
|
22380
22395
|
case "p":
|
|
22381
|
-
return "".concat(
|
|
22396
|
+
return "".concat(H, "\n");
|
|
22382
22397
|
case "img": {
|
|
22383
22398
|
const J = M.getAttribute("src") || "", qe = M.getAttribute("alt") || "";
|
|
22384
22399
|
return J ? "\n.concat(J, ")\n") : "";
|
|
@@ -22579,7 +22594,7 @@ const G = new z("chat-input"), mc = window.SpeechRecognition || window.webkitSpe
|
|
|
22579
22594
|
] });
|
|
22580
22595
|
};
|
|
22581
22596
|
const Ne = new z("chat-topic-item"), vy = (n) => {
|
|
22582
|
-
const { hasMoreThanOne: e, controller: t, topic: i, onClick: r, onAction: s } = n, o =
|
|
22597
|
+
const { hasMoreThanOne: e, controller: t, topic: i, onClick: r, onAction: s } = n, o = V(null), a = ne(() => {
|
|
22583
22598
|
var b;
|
|
22584
22599
|
return ((b = t.activedTopic.value) == null ? void 0 : b.id) === i.id;
|
|
22585
22600
|
}), [l, c] = q(!1), d = D([]);
|
|
@@ -22666,7 +22681,7 @@ const Ne = new z("chat-topic-item"), vy = (n) => {
|
|
|
22666
22681
|
);
|
|
22667
22682
|
};
|
|
22668
22683
|
const Ce = new z("chat-topics"), yy = (n) => {
|
|
22669
|
-
const e =
|
|
22684
|
+
const e = V(null), t = D(void 0), i = D([]);
|
|
22670
22685
|
L(() => {
|
|
22671
22686
|
const u = [...n.controller.topics.value].sort((h, p) => h.isTop !== p.isTop ? p.isTop ? 1 : -1 : h.sequence - p.sequence);
|
|
22672
22687
|
i.value = u.filter(
|
|
@@ -22813,7 +22828,7 @@ const Ce = new z("chat-topics"), yy = (n) => {
|
|
|
22813
22828
|
] }) });
|
|
22814
22829
|
};
|
|
22815
22830
|
const Zt = new z("chat-minimize"), by = (n) => {
|
|
22816
|
-
const e =
|
|
22831
|
+
const e = V(null), [t, i] = q(""), [r, s] = q(0), o = V(!1), a = {
|
|
22817
22832
|
x: (window.innerWidth - 86) / window.innerWidth,
|
|
22818
22833
|
y: (window.innerHeight - 86) / window.innerHeight
|
|
22819
22834
|
}, l = ne(() => {
|